<#-- 页头 公共页(生成新引用页) -->
<div class="headerModule">
    <div class="box">
        <a href="/" class="logo">
            <#--180x40-->
            <img alt="logo" style="height: 40px;width: 80px" src="${commonPath}images/logo.png">
        </a>
        <#-- 引入站点栏目 -->
        <@include action="${columnRelated_column_1}"/>

        <div class="head-search">
            <form action="/search" method="get">
                <input name="keyword" value="${keyword}" autocomplete="off" placeholder="搜索可能来的更快">
                <input type="submit" class="sub-button" value="">
                <i class="icon cms-search"></i>
            </form>
        </div>
        <div class="menu">
            <ul class="clearfix">
                <#-- 未登录 -->
                <#if systemUser == null>
                    <li><a href="/register" class="a-button">注册</a></li>
                    <li><a href="/login" class="a-button">登录</a></li>
                <#else>
                <#-- 已登录 -->
                    <li>
                        <div class="author">
                            <a href="/user/control/home">
                                <#if systemUser.avatarName != null>
                                    <img src="${systemUser.avatarPath}100x100/${systemUser.avatarName}" alt="">
                                <#else>
                                    <span class="avatarImg">
		                      			<span class="circle"><i class="cms-user2"></i></span>
			                      	</span>
                                </#if>
                            </a>
                        </div>
                        <a class="userName"
                           href="/user/control/home">${(systemUser.nickname != null && systemUser.nickname??) ?string(systemUser.nickname , systemUser.userName)}</a>
                    </li>
                    <li><a href="/user/control/home">用户中心<span id="allMessage-badge" class="badge"
                                                              style="position: absolute; margin-top: 14px; display: none;"></span></a>
                    </li>
                    <li><a href="" onClick="javascript:document.getElementById('logout').submit();return false;">退出</a>
                    </li>
                    <form id="logout" action="logout.htm?token=${token}" method="post"></form>
                    <script type="text/javascript">
                        //查询未读消息
                        function queryUnreadMessage() {
                            get_request(function (value) {
                                if (value != "") {
                                    var unreadMessage = JSON.parse(value);
                                    var privateMessageCount = parseInt(unreadMessage.privateMessageCount);
                                    var systemNotifyCount = parseInt(unreadMessage.systemNotifyCount);
                                    var remindCount = parseInt(unreadMessage.remindCount);
                                    if (privateMessageCount > 0) {
                                        //显示红点
                                        var privateMessage_badge = document.getElementById("privateMessage-badge");//用户中心页
                                        if (privateMessage_badge != null) {
                                            privateMessage_badge.style.display = "";//显示
                                        }
                                    } else {
                                        //隐藏红点
                                        var privateMessage_badge = document.getElementById("privateMessage-badge");//用户中心页
                                        if (privateMessage_badge != null) {
                                            privateMessage_badge.style.display = "none";//隐藏
                                        }
                                    }
                                    if (systemNotifyCount > 0) {
                                        //显示红点
                                        var systemNotify_badge = document.getElementById("systemNotify-badge");//用户中心页
                                        if (systemNotify_badge != null) {
                                            systemNotify_badge.style.display = "";//显示
                                        }
                                    } else {
                                        //隐藏红点
                                        var systemNotify_badge = document.getElementById("systemNotify-badge");//用户中心页
                                        if (systemNotify_badge != null) {
                                            systemNotify_badge.style.display = "none";//隐藏
                                        }
                                    }
                                    if (remindCount > 0) {
                                        //显示红点
                                        var remind_badge = document.getElementById("remind-badge");//用户中心页
                                        if (remind_badge != null) {
                                            remind_badge.style.display = "";//显示
                                        }
                                    } else {
                                        //隐藏红点
                                        var remind_badge = document.getElementById("remind-badge");//用户中心页
                                        if (remind_badge != null) {
                                            remind_badge.style.display = "none";//隐藏
                                        }
                                    }

                                    //所有消息
                                    if ((privateMessageCount + systemNotifyCount + remindCount) > 0) {
                                        //显示红点
                                        var allMessage_badge = document.getElementById("allMessage-badge");
                                        if (allMessage_badge != null) {
                                            allMessage_badge.style.display = "";//显示
                                        }
                                    } else {
                                        //隐藏红点
                                        var allMessage_badge = document.getElementById("allMessage-badge");
                                        if (allMessage_badge != null) {
                                            allMessage_badge.style.display = "none";//隐藏
                                        }
                                    }
                                }
                            },
                                "user/control/unreadMessageCount?timestamp=" + new Date().getTime(), true);
                        }

                        queryUnreadMessage();
                    </script>

                </#if>
            </ul>
        </div>
    </div>
</div>


